
package net.atremmedia.gwt.actionjava.examples.advanced.samples.nodes;

import actionjava.display.Graphics;
import actionjava.display.Shape;
import actionjava.geom.Color;

public class Particle extends Shape
{
	private double radius;
	private double vx = 0;
	private double vy = 0;
	private double mass = 1;
	private Graphics graphics;

	public Particle(double radius, int color)
	{
		this.radius = 2;
		init(color);
	}

	public void init(int color)
	{
		graphics = getGraphics();
		graphics.beginFill(Color.getRGB(color));
		graphics.drawCircle(0, 0, radius);
		graphics.endFill();
		setCacheAsBitmap(true);
	}

	public void plusVx(double value)
	{
		vx += value;
	}

	public void minVx(double value)
	{
		vx -= value;
	}

	public void plusVy(double value)
	{
		vy += value;
	}

	public void minVy(double value)
	{
		vy -= value;
	}

	public double getVx()
	{
		return vx;
	}

	public void setVx(double vx)
	{
		this.vx = vx;
	}

	public double getVy()
	{
		return vy;
	}

	public void setVy(double vy)
	{
		this.vy = vy;
	}

	public double getMass()
	{
		return mass;
	}

	public void setMass(double mass)
	{
		this.mass = mass;
	}

	public double getRadius()
	{
		return radius;
	}

	public void setRadius(double radius)
	{
		this.radius = radius;
	}
}
